home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / OUI / include / window_inlines.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.8 KB  |  299 lines

  1. // $Id: window_inlines.h 1.1 1997/07/14 04:24:06 dlorre Exp $
  2. #if !defined( CLASS_WINDOW_INLINES_H )
  3. #define CLASS_WINDOW_INLINES_H
  4.  
  5. #include <stdio.h>
  6. #include <string.h>
  7.  
  8. #include <proto/exec.h>
  9. #include <proto/graphics.h>
  10. #include <proto/layers.h>
  11. #include <proto/intuition.h>
  12. #include <proto/gadtools.h>
  13. #include <proto/utility.h>
  14.  
  15. inline void window::setfunc(void (*func)(long , unsigned long, unsigned short))
  16. {
  17.     reqfunc = func ;
  18. }
  19.  
  20. inline void window::titles(const char *wt, const char *st)
  21. {
  22.     if (win) SetWindowTitles(win, (UBYTE *)wt, (UBYTE *)st) ;
  23. }
  24.  
  25. inline void window::activate()
  26. {
  27.     if (win) ActivateWindow(win) ;
  28. }
  29.  
  30. inline void window::front()
  31. {
  32.     if (win) WindowToFront(win) ;
  33. }
  34.  
  35. inline void window::back()
  36. {
  37.     if (win) WindowToBack(win) ;
  38. }
  39.  
  40. inline void window::resetidcmp()
  41. {
  42.     ModifyIDCMP(win, idcmp) ;
  43. }
  44.  
  45. inline void window::recessedbox(short x, short y, short w, short h)
  46. {
  47.     if (win)
  48.         DrawBevelBox(rp, x, y, w, h,
  49.         GT_VisualInfo, ws->vi,
  50.         GTBB_Recessed, TRUE,
  51.         TAG_END);
  52. }
  53.  
  54.  
  55. inline void window::bevelbox(short x, short y, short w, short h)
  56. {
  57.     if (win)
  58.         DrawBevelBox(rp, x, y, w, h,
  59.         GT_VisualInfo, ws->vi,
  60.         TAG_END);
  61. }
  62.  
  63.  
  64. inline MenuItem *window::itemaddress( unsigned long menuNumber )
  65. {
  66.     return ItemAddress( menu, menuNumber) ;
  67. }
  68.  
  69. inline MenuItem *window::itemaddress(LONG m, LONG i, LONG s)
  70. {
  71.     return ItemAddress(menu, FULLMENUNUM(m, i, s)) ;
  72. }
  73.  
  74. inline void window::clearmenustrip(void)
  75. {
  76.     ClearMenuStrip(win) ;
  77. }
  78.  
  79. inline BOOL window::resetmenustrip(void)
  80. {
  81.     return ResetMenuStrip(win, menu) ;
  82. }
  83.  
  84.  
  85. inline void window::draw(long x, long y)                       // Draw(rp, ...)
  86. {
  87.     Draw(rp, x, y) ;
  88. }
  89.  
  90. inline void window::polydraw(long count, WORD *polyTable)
  91. {
  92.     PolyDraw(rp, count, polyTable) ;
  93. }
  94.  
  95. inline void window::rectfill(long xMin, long yMin, long xMax, long yMax)
  96. {
  97.     RectFill(rp, xMin, yMin, xMax, yMax) ;
  98. }
  99.  
  100. inline void window::eraserect(long xMin, long yMin, long xMax, long yMax )
  101. {
  102.     EraseRect(rp, xMin, yMin, xMax, yMax) ;
  103. }
  104.  
  105. inline void window::setapen(unsigned long pen)
  106. {
  107.     SetAPen(rp, pen) ;
  108. }
  109.  
  110. inline void window::setbpen(unsigned long pen)
  111. {
  112.     SetBPen(rp, pen) ;
  113. }
  114.  
  115. inline void window::setopen(unsigned long pen)
  116. {
  117.     SafeSetOutlinePen(rp, char(pen)) ;
  118. }
  119.  
  120. inline void window::setrast(unsigned long pen)
  121. {
  122.     SetRast(rp, pen) ;
  123. }
  124.  
  125. inline void window::setdrmd(unsigned long drawMode)
  126. {
  127.     SetDrMd(rp, drawMode) ;
  128. }
  129.  
  130. inline void window::setdrpt(UWORD pattern)
  131. {
  132.     SetDrPt(rp, pattern) ;
  133. }
  134.  
  135. inline void window::setafpt(const UWORD *pattern, BYTE count)
  136. {
  137.     SetAfPt(rp, (UWORD *)pattern, count) ;
  138. }
  139.  
  140. inline short window::textlength(const char *string, unsigned long count )
  141. {
  142.     return TextLength(rp, STRPTR(string), count );
  143. }
  144.  
  145.  
  146. inline unsigned long window::textfit(const char *string, unsigned long strLen,
  147.     struct TextExtent *textExtent, struct TextExtent *constrainingExtent,
  148.     long strDirection, unsigned long constrainingBitWidth,
  149.     unsigned long constrainingBitHeight )
  150. {
  151.     return TextFit(rp, STRPTR(string), strLen, textExtent, constrainingExtent,
  152.         strDirection, constrainingBitWidth, constrainingBitHeight) ;
  153. }
  154.  
  155. inline void window::setfont(TextFont *font)
  156. {
  157.     SetFont( rp, font) ;
  158. }
  159.  
  160. // Intuition Drawing Routines
  161.  
  162. inline void window::printitext(IntuiText *iText, long left, long top )
  163. {
  164.     PrintIText( rp, iText, left, top) ;
  165. }
  166.  
  167. inline void window::drawborder( Border *border, long leftOffset, long topOffset )
  168. {
  169.     DrawBorder( rp, border, leftOffset, topOffset );
  170. }
  171.  
  172.  
  173. inline void window::drawimage( struct Image *image, long leftOffset, long topOffset )
  174. {
  175.     DrawImage( rp, image, leftOffset, topOffset );
  176. }
  177.  
  178. inline void window::eraseimage( struct Image *image, long leftOffset, long topOffset )
  179. {
  180.     EraseImage( rp, image, leftOffset,  topOffset );
  181. }
  182.  
  183. // Clip Routines
  184.  
  185. inline int window::newregion(void)
  186. {
  187.     clipregion = NewRegion() ;
  188.     if (clipregion) {
  189.         cliprect = new Rectangle ;
  190.         if (!cliprect) {
  191.             DisposeRegion( clipregion ) ;
  192.             clipregion = NULL ;
  193.         }
  194.     }
  195.  
  196.     return (clipregion != NULL) ;
  197. }
  198.  
  199. inline void window::disposeregion(void)
  200. {
  201.     delete cliprect ;
  202.     DisposeRegion( clipregion );
  203. }
  204.  
  205. inline BOOL window::addregion(short l, short t, short w, short h)
  206. {
  207.     cliprect->MinX = l ;
  208.     cliprect->MaxX = short(l+w) ;
  209.     cliprect->MinY = t ;
  210.     cliprect->MaxY = short(t+h) ;
  211.     return OrRectRegion(clipregion, cliprect) ;
  212. }
  213.  
  214. inline void window::installclip(void)
  215. {
  216.     InstallClipRegion(win->WLayer, clipregion) ;
  217. }
  218.  
  219. inline void window::removeclip(void)
  220. {
  221.     clipregion = InstallClipRegion(win->WLayer, NULL) ;
  222. }
  223.  
  224. // Pointer Routines
  225.  
  226. inline void window::setpointer( UWORD *pointer, long height,
  227.     long width, long xOffset, long yOffset )
  228. {
  229.     SetPointer(win, pointer, height, width, xOffset, yOffset) ;
  230. }
  231.  
  232. inline void window::clearpointer()
  233. {
  234.     ClearPointer(win) ;
  235. }
  236.  
  237. // Area Routines
  238.  
  239. inline long window::areaellipse(long xCenter, long yCenter, long a, long b )
  240. {
  241.     return AreaEllipse( rp, xCenter, yCenter, a, b ) ;
  242. }
  243.  
  244. inline long window::areamove( long x, long y )
  245. {
  246.     return AreaMove( rp, x, y );
  247. }
  248.  
  249. inline long window::areadraw( long x, long y )
  250. {
  251.     return AreaDraw( rp, x, y );
  252. }
  253.  
  254. inline long window::areaend()
  255. {
  256.     return AreaEnd( rp );
  257. }
  258.  
  259. inline BOOL window::flood( unsigned long mode, long x, long y )
  260. {
  261.     return Flood( rp, mode, x, y );
  262. }
  263.  
  264. // BackGround Drawing routines
  265.  
  266. inline void window::setbgrp(RastPort *brp)
  267. {
  268.     rp = bgrp = brp ;
  269.     bgbm = bgrp->BitMap ;
  270. }
  271.  
  272. inline void window::clearbgrp()
  273. {
  274.     rp = win->RPort ;
  275. }
  276.  
  277. inline void window::flushbg(int x, int y, int w, int h, int mode)
  278. {
  279.     BltBitMapRastPort(bgbm, 0, 0, win->RPort, x, y, w, h, mode);
  280. }
  281.  
  282. // Refresh routines
  283.  
  284. inline void window::beginrefresh()
  285. {
  286.     GT_BeginRefresh(win) ;
  287. }
  288.  
  289. inline void window::endrefresh(BOOL end)
  290. {
  291.     GT_EndRefresh(win, end) ;
  292. }
  293.  
  294. inline void window::refreshwindowframe()
  295. {
  296.     RefreshWindowFrame(win) ;
  297. }
  298. #endif
  299.